package main

import (
	"fmt"
	prototext "go_keep_learning/grpc/01_protobuf/proto"

	"google.golang.org/protobuf/proto"
)

func main() {

	pandaRequest := &prototext.PandaRequest{Name: "wdc", Age: 25, Height: []int32{175}}
	fmt.Println(pandaRequest)

	//编码
	data, err := proto.Marshal(pandaRequest)
	if err != nil {
		fmt.Println("编码失败")
	}
	fmt.Println(data)

	//解码
	newtest := &prototext.PandaRequest{}
	proto.Unmarshal(data, newtest)
	fmt.Println(newtest)

}
